package com.zjc.stock.model;

import com.zjc.stock.TransactionType;

import java.text.NumberFormat;

/**
 * 费用明细
 */
public class FeeDetail {
    private TransactionType type;

    /**
     * 佣金
     */
    private Double commission;
    /**
     * 成交金额（元）
     */
    private Double amount;
    private Double stampTax;    // 印花税
    private Double transferFee; // 过户费
    private Double totalFee;


    public TransactionType getType() {
        return type;
    }

    public void setType(TransactionType type) {
        this.type = type;
    }

    public Double getCommission() {
        return commission;
    }

    public void setCommission(Double commission) {
        this.commission = commission;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Double getStampTax() {
        return stampTax;
    }

    public void setStampTax(Double stampTax) {
        this.stampTax = stampTax;
    }

    public Double getTransferFee() {
        return transferFee;
    }

    public void setTransferFee(Double transferFee) {
        this.transferFee = transferFee;
    }

    public Double getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Double totalFee) {
        this.totalFee = totalFee;
    }


    public void print() {
        NumberFormat nf = NumberFormat.getCurrencyInstance();
        nf.setMaximumFractionDigits(2);
        System.out.println("交易类型: " + (type == TransactionType.BUY ? "买入" : "卖出"));
        System.out.println("成交金额: " + nf.format(amount));
        System.out.println("佣金: " + nf.format(commission));
        System.out.println("印花税: " + nf.format(stampTax));
        System.out.println("过户费: " + nf.format(transferFee));
        System.out.println("总手续费: " + nf.format(totalFee));
    }

}
